
      google.load("visualization", "1", {packages:["corechart"]});

	  
      function drawChart(object,parametr, element, number,table_name,sun_rad,object2,object3,object4) {
    var day_number = document.getElementById("day_number").value*1;
    var latitude = document.getElementById("latitude").value*1;
    var longitude = document.getElementById("longitude").value*1;
    var zone = document.getElementById("zone").value*1;
    var psi = document.getElementById(element+"_psi_"+number).value*1;
    var tilt = document.getElementById(element+"_tilt_"+number).value*1;
    var taub = document.getElementById("taub").value*1;
    var taud = document.getElementById("taud").value*1;
    var gr_rf = document.getElementById("gr_rf").value*1;
    var alfa_h0 = document.getElementById("alfa_h0").value*1;
    var epsilon_deltaR_h0 = document.getElementById("epsilon_deltaR_h0").value*1;
	
	var table_data = new Array();
	   for (var i=1; i<=24; i++){
	   var myrad = new radiation(day_number, i, latitude, longitude, zone, psi, tilt, taub, taud, gr_rf, t_hour[i], alfa_h0, epsilon_deltaR_h0); 
       table_data[i-1]  = new Array();
	   table_data[i-1][0] = i.toString();
	   if (object == 'sun') {
       table_data[i-1][1] = mysun_on_plane[parametr];
       }
      else if (object == 'radiation') {
	  table_data[i-1][1] = myrad[parametr];
	  }
	   else if(object2){
	   if(object3 && object4){
	   table_data[i-1][1] = object[i]*object2*1+object3[i]*object4*1;
	   }
	   else
	   table_data[i-1][1] = object[i]*object2*1;
	   }
	    else { table_data[i-1][1] = object[i]*1
		}
	  }

//alert(document.getElementById("dialog_" +element+ "_"+number+"_"+parametr+ "_graph1") != null ? true : false);

	   open_dialog(element,number, parametr+ '_graph1',1,sun_rad);
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'xxx');
        data.addColumn('number', '');
           data.addRows(table_data);
        
        var chart = new google.visualization.AreaChart(document.getElementById(element + "_" + number + "_"+parametr+ "_graph2"));
        chart.draw(data, {width: 1000, height: 240, title: table_name,
                          hAxis: {title: 'Часы', titleTextStyle: {color: '#FF0000'}, showTextEvery:1}
                         });

      }